package com.visionblue.business.ship.util.ext

import android.view.View
import android.widget.EditText

/**
 *  Created by xialihao on 2018/12/6.
 */

fun EditText.isEmpty(): Boolean {
    return text.toString().isEmpty()
}

fun EditText.toInt(): Int {
    return text.toString().toInt()
}

fun EditText.toLong(): Long {
    return text.toString().toLong()
}

fun EditText.showText(text: String?) {
    setText(text)
    moveCursorLast()
}

fun EditText.moveCursorLast() {
    setSelection(text.length)
}

fun View.setVisible(isVisible: Boolean) {
    visibility = if (isVisible) View.VISIBLE else View.GONE
}
